import pandas as pd


class Rule:
    rules = []

    def __init__(self, pattern, faultReasonType, faultReasonDetail, fualtReason, dealMeas):
        self.pattern = pattern  # 工单标题匹配模式
        self.faultReasonType = faultReasonType  # 故障分类
        self.faultReasonDetail = faultReasonDetail  # 子类
        self.fualtReason = fualtReason  # 原因
        self.dealMeas = dealMeas  # 措施

    def __str__(self):
        return '{}, {}'.format(self.pattern, self.dealMeas)

    def isNone(self):
        return self.pattern == 'None'


# *[数据网][山东东营]SDDOY-MC-CMNET-SW09-S9312-XCJ4_XGigabitEthernet11/0/3端口DOWN:_TO-[SDDOY-MA-CMNET-GPON-MA5680T-ShengBeiQuanYeWu
# *[数据网][山东东营]SDDOY-MC-CMNET-SW10-S9312-KL3_Eth-Trunk104端口DOWN:_TO-[GPON-MA5680T-XinYiZhong]-2G


file_path = './rules.xlsx'
df = pd.read_excel(r"rules.xlsx", sheet_name=0)

for index, row in df.iterrows():
    rule = Rule(row[0], row[1], row[2], row[3], row[4])
    Rule.rules.append(rule)

del df

# 交换网
# <fieldContent>02-001*系统#02-002*传输#02-003*人为#02-004*外部#02-006*自然灾害#02-008*无线网优#02-007*动力环境#02-009*安全事件#02-999*其他</fieldContent>
# <fieldContent>02-010-01*省际#02-009-001*恶意软件#02-999-001*误告警#02-008-002*用户突发原因#02-009-002*网络攻击#02-009-003*安全设备故障#02-002-001*光缆#02-009-004*配置违规#02-009-005*网络安全漏洞#02-008-006*无线资源受限#02-009-006*操作信息提示#02-001-006*设备连线#02-002-004*传输设备#02-008-007*无线参数问题#02-002-999*其他#02-002-007*尾纤#02-008-008*无线设备故障#02-003-001*工程#02-007-009*供电故障#02-003-002*操作#02-001-008*单板故障#02-007-010*温度异常#02-003-003*局数据#02-001-009*机框故障#02-001-010*电源模块故障#02-007-011*湿度异常#02-001-011*风扇故障#02-007-012*烟感异常#02-003-999*其他#02-001-012*系统容量不足#02-004-001*其他运营商设备#02-001-013*License#02-004-002*其他运营商线路#02-001-014*系统备份#02-004-006*省内对端设备#02-001-015*进程异常#02-004-007*省际对端#02-005-001*温度#02-001-016*磁盘空间不足#02-001-017*设备吊死#02-005-002*电力#02-005-999*其他#02-001-018*软件#02-004-008*客户侧原因#02-006-002*洪水#02-006-003*泥石流#02-006-004*台风#02-006-005*暴雨#02-006-006*雷击#02-006-007*塌方#02-006-008*地震#02-006-999*其他#02-999-999*其他#02-001-999*其他#02-007-999*其他#02-008-999*其他#02-009-999*其他#02-010-02*其他#02-004-999*其他</fieldContent>
'''
02-002*传输
02-002-001*光缆
02-002-004*传输设备
'''

# 数据网
'''
<fieldContent>03-001*系统#03-002*传输#03-003*人为#03-004*外部#03-006*自然灾害#03-007*无线网优#03-008*动力环境#03-009*安全事件</fieldContent>
<fieldContent>03-003-002*操作#03-006-005*暴雨#03-006-008*地震#03-005-002*电力#03-003-001*工程#03-002-001*光缆#03-006-002*洪水#03-006-006*雷击#03-006-999*其他#03-006-007*塌方#03-006-004*台风#03-005-001*温度#03-003-003*局数据#03-006-003*泥石流#03-001-004*参数配置#03-002-004*传输设备#03-004-001*其它运营商设备#03-004-002*其它运营商线路#03-003-004*其他#03-001-021*单板故障#03-001-022*机框故障#03-001-023*电源模块故障#03-001-024*风扇故障#03-001-025*系统容量不足#03-001-026*License#03-001-027*系统备份#03-009-001*恶意软件#03-008-001*供电故障#03-007-001*用户突发原因#03-004-008*客户侧原因#03-004-007*省际对端#03-004-006*省内对端设备#03-002-006*尾纤#03-008-002*温度异常#03-009-002*网络攻击#03-007-002*无线设备故障#03-007-003*无线资源受限#03-009-003*安全设备故障#03-008-003*湿度异常#03-007-004*无线参数问题#03-009-004*配置违规#03-008-004*烟感异常#03-009-005*网络安全漏洞#03-009-006*操作信息提示#03-001-014*进程异常#03-001-015*磁盘空间不足#03-001-016*设备吊死#03-001-017*软件版本#03-001-018*硬盘#03-001-019*网卡#03-001-020*防尘网#03-001-028*光模块#03-001-999*其他#03-008-999*其他#03-009-999*其他#03-007-999*其他#03-004-999*其他#03-002-999*其他</fieldContent>
'''
